package org.vectrics.recruiter.struts.admin;

import org.apache.ecs.html.A;
import org.vectrics.common.html.Cell;
import org.vectrics.common.html.Row;
import org.vectrics.common.html.Table;
import org.vectrics.struts.VectricsTagSupport;


public abstract class AdminSummaryBaseTag extends VectricsTagSupport {

	private static final long serialVersionUID = 7770751237278936397L;
	
	private Table contentTable = null;
	private String descriptionCellWidth = "500"; 
	private String linkCellWidth = "100"; 
	private String tableWidth = "600"; 
	public AdminSummaryBaseTag() {
		super();
	}
	
	abstract protected String getHeader();

	abstract protected void fillContentCell();
	
	protected final String makeStartTag() {
		Table table = new Table();
		table.setCellPadding(0);
		table.setCellSpacing(0);
		table.setWidth(tableWidth);
		
		Row headerRow = table.addRow();
		Cell headerCell = headerRow.addCell();
		headerCell.setClass("formBg2");
		headerCell.addText("adminSummaryHeader", this.getHeader());

		Row row = table.addRow();
		Cell contentCell = row.addCell();
		contentCell.setClass("formBg1");
		contentTable = new Table();
		contentCell.addElement(contentTable);
		this.fillContentCell();
		return(table.toString());
	}

	protected void addContentRow(String text) {
		Row row = contentTable.addRow();
		Cell cell = row.addCell();
		cell.setWidth(this.descriptionCellWidth);
		cell.addText("stdFont", text);
		Cell linkCell = row.addCell();
	}

	protected void addContentRow(String text, String href, String caption) {
		Row row = contentTable.addRow();
		Cell cell = row.addCell();
		cell.setWidth(this.descriptionCellWidth);
		cell.addText("stdFont", text);

		Cell linkCell = row.addCell();
		A link = new A();
		link.setHref(href);
		link.addElement(caption);
		link.setClass("stdLink");
		linkCell.addElement(link);
		linkCell.setWidth(this.linkCellWidth);
		
	}
	
}
